take derivative of a rational function